package com.brspace.qualitycontrol.controller.admin;


import com.brspace.qualitycontrol.entity.ProcessNode;
import com.brspace.qualitycontrol.service.ProcessNodeService;

import com.brspace.qualitycontrol.utils.JsonResult;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 *  流程节点
 * </p>
 *
 * @author Hugo
 * @since 2021-03-22
 */
@Api(description = "节点")
@RestController
@RequestMapping("/admin/process/node")
public class NodeController {

    @Resource
    private ProcessNodeService nodeService;

    /**
     * 节点数据录入
     *
     * @Params node
     * @return null
     */
    @PostMapping("save")
    public R saveNode(ProcessNode node) {
        nodeService.saveNode(node);
        return  R.ok();
    }
    @ApiOperation("节点信息录入")
    @PostMapping("addNode")
    public R addNode(@ApiParam("节点对象") @RequestBody ProcessNode node){
        nodeService.saveNode(node);
        return R.ok();
    }

    /**
     *@Description 获取节点
     *@Params [pId]
     *@author Hugo
     *@date 2021-03-23 16:52
     *@return null
     **/
    @PostMapping("getNode/{pId}")
    public R getNode(@PathVariable int pId){
        return  R.ok().data("list",nodeService.findByPid(pId));
    }
}

